package com.haois.component.util.excel;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.FileOutputStream;

/**
 * description
 *
 * @author RuiHaoZ on GCU
 * @date 2017/3/17 9:18
 */
public class SaveFile {

    public static void saveFileOnLocal(HSSFWorkbook workbook, String nativePath, String fileName) {
        try {
            Logger logger = LoggerFactory.getLogger(SaveFile.class);
            FileOutputStream outputStream = new FileOutputStream(nativePath + fileName);
            workbook.write(outputStream);
            outputStream.close();
            logger.info("文件[{}]生成到本地[{}]", fileName, nativePath);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
